<template>
  <div class="visualBlock" style="z-index:100">
    <div class="title-header">
      <div class="title center">登记表</div>
    </div>
    <div class="main-scroll scrollBody" style="">
      <div class="ryc1">
        <label>核查来源：</label>
        <div class="ryc2 selectDiv">
          <select class="search_select" v-model="item.hcly">
            <option value="110接处">110接处</option>
            <option value="指令核处">指令核处</option>
            <option value="社区摸排">社区摸排</option>
            <option value="卡口检查">卡口检查</option>
          </select>
        </div>
      </div>
      <div class="ryc1" v-show="item.hcly == '卡口检查'">
        <label class="require">盘查卡点：</label>
        <div class="ryc2 selectDiv">
          <select class="ryc2 search_select" v-model="item.pckd">
            <option value="">请选择</option>
            <option v-for="(name, index) in kklist" :key="index" :value="name">{{name}}</option>
          </select>
        </div>
      </div>
      <div class="ryc1">
        <label>来澄方式：</label>
        <div class="ryc2">
          <input id="lcfsradio1" type="radio" name="lcfs" value="公共交通" v-model="item.lcfs">
          <label for="lcfsradio1">公共交通</label>
          <input id="lcfsradio2" type="radio" name="lcfs" value="私家车辆" v-model="item.lcfs">
          <label for="lcfsradio2">私家车辆</label>
        </div>
      </div>
      <div class="ryc1" v-show="item.lcfs == '公共交通'">
        <label>公共交通备注（车次/航班/汽车/自驾）：</label>
        <div class="ryc2">
          <input type="text" class="ryc_txt" v-model="item.ggjtbz">
        </div>
      </div>
      <div class="ryc1" v-show="item.lcfs == '私家车辆'">
        <label>驾乘车辆号牌：</label>
        <div class="ryc2">
          <input type="text" class="ryc_txt" v-model="item.jcclhp">
        </div>
      </div>
      <div class="ryc1" v-show="item.lcfs == '私家车辆'">
        <label>驾乘车辆号牌类型：</label>
        <div class="ryc2">
          <input id="jcclhplxradio2" type="radio" name="jcclhplx" value="蓝牌" v-model="item.jcclhplx">
          <label for="jcclhplxradio2">蓝牌</label>
          <input id="jcclhplxradio1" type="radio" name="jcclhplx" value="黄牌" v-model="item.jcclhplx">
          <label for="jcclhplxradio1">黄牌</label>
          <input id="jcclhplxradio3" type="radio" name="jcclhplx" value="绿牌" v-model="item.jcclhplx">
          <label for="jcclhplxradio3">绿牌</label>
        </div>
      </div>
      <div class="ryc1" v-show="item.lcfs == '私家车辆'">
        <label>驾乘车辆来源地：</label>
        <div class="ryc2 selectDiv">
          <select class="search_select" v-model="item.jccllyd">
            <option value="不明">不明</option>
            <option value="湖北">湖北</option>
            <option value="非湖北">非湖北</option>
          </select>
        </div>
      </div>
      <div class="ryc1">
        <label>到澄时间：</label>
        <div class="ryc2">
          <input type="datetime-local" class="ryc_txt" v-model="item.dcsj">
        </div>
      </div>
      <div class="title1">二、人员明细</div>
      <!--省市区三级联动-->
      <div class="divwrap" v-if="showSsxPick">
        <v-distpicker type="mobile" @province="onChangeProvince1" @city="onChangeCity" @area="onChangeArea"
        :province="ssxObject.province" :city="ssxObject.city" :area="ssxObject.area"></v-distpicker>
      </div>
      <!--遮罩层-->
      <div class="blacks" v-if="showSsxPick" @click="showSsxPick = false"></div>
      <div class="persons">
        <template v-for="(person, index) in item.persons">
          <div class="person" :key="index">
            <div class="ryc1">
              <label :class="{require: person.useSfz=='1'}">
                <input :id="'personusersfzh1' + index" type="radio" :name="'personusersfzh' + index" value="1" v-model="person.useSfz">
                <label :for="'personusersfzh1' + index">身份证号：</label>
              </label>
              <div class="ryc2" v-show="person.useSfz=='1'">
                <input type="text" class="ryc_txt" v-model="person.sfzhm" @change="personSfzChanged(person)">
              </div>
            </div>
            <div class="ryc1">
              <label :class="{require: person.useSfz=='0'}">
                <input :id="'personusersfzh2' + index" type="radio" :name="'personusersfzh' + index" value="0" v-model="person.useSfz">
                <label :for="'personusersfzh2' + index">出生日期(无法提供证件用)：</label>
              </label>
              <div class="ryc2" v-show="person.useSfz=='0'">
                <input type="date" class="ryc_txt" v-model="person.csrq" @change="personSfzChanged(person, true)">
              </div>
            </div>
            <div class="ryc1">
              <label class="require">姓名：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.xm">
              </div>
            </div>
            <div class="ryc1">
              <label class="require">性别：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.xb">
              </div>
            </div>
            <div class="ryc1">
              <label class="require">年龄：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.nl">
              </div>
            </div>
            <div class="ryc1">
              <label class="require">核查状况：</label>
              <div class="ryc2 selectDiv">
                <select class="ryc2 search_select" v-model="person.hczk">
                  <option value="">请选择</option>
                  <option value="见面核查">见面核查</option>
                  <option value="不在江阴/已离澄（无法核查）">不在江阴/已离澄（无法核查）</option>
                  <option value="住址错误（无法核查）">住址错误（无法核查）</option>
                  <option value="无法联系（无法核查）">无法联系（无法核查）</option>
                </select>
              </div>
            </div>
            <div class="ryc1">
              <label :class="{require: !judgeRequire(person)}">职业：</label>
              <div class="ryc2 selectDiv">
                <select class="ryc2 search_select" v-model="person.zy">
                  <option value="">请选择</option>
                  <option value="国家机关、党群组织人员">国家机关、党群组织人员</option>
                  <option value="企业、事业单位负责人">企业、事业单位负责人</option>
                  <option value="专业技术人员">专业技术人员</option>
                  <option value="办事人员和有关人员">办事人员和有关人员</option>
                  <option value="商业、服务业人员">商业、服务业人员</option>
                  <option value="农、林、牧、渔、水利业生产人员">农、林、牧、渔、水利业生产人员</option>
                  <option value="生产、运输设备操作及有关人员">生产、运输设备操作及有关人员</option>
                  <option value="军人">军人</option>
                  <option value="其他从业人员">其他从业人员</option>
                </select>
              </div>
            </div>
            <div class="ryc1">
              <label :class="{require: judgeRequire(person) == 1}">手机号码：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.lxfs">
              </div>
            </div>
            <div class="ryc1">
              <label>来澄事宜：</label>
              <div class="ryc2 selectDiv">
                <select class="ryc2 search_select" v-model="person.lcsy">
                  <option value="返乡">返乡</option>
                  <option value="旅游">旅游</option>
                  <option value="上学">上学</option>
                  <option value="务工">务工</option>
                  <option value="探亲">探亲</option>
                  <option value="其他">其他</option>
                </select>
              </div>
            </div>
            <div class="ryc1">
              <label>在澄详址：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.zcjzdz">
              </div>
            </div>
            <!-- <div class="ryc1" v-show="item.hcly == '社区摸排'">
              <label>是否在澄误工：</label>
              <div class="ryc2">
                <input :id="'personsfwgradio2' + index" type="radio" :name="'personsfwg' + index" value="是" v-model="person.sfwg">
                <label :for="'personsfwgradio2' + index">是</label>
                <input :id="'personsfwgradio1' + index" type="radio" :name="'personsfwg' + index" value="否" v-model="person.sfwg">
                <label :for="'personsfwgradio1' + index">否</label>
              </div>
            </div> -->
            <div class="ryc1">
              <label>在澄紧急联系人姓名：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.zclxrxm">
              </div>
            </div>
            <div class="ryc1">
              <label>紧急联系人手机号：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.zclxrlxfs">
              </div>
            </div>
            <div class="ryc1">
              <label>工作单位：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.gzdw">
              </div>
            </div>
            <div class="ryc1">
              <label :class="{require: judgeRequire(person) != 2}">人员性质：</label>
              <div class="ryc2">
                <input :id="'personryxzradio2' + index" type="radio" :name="'personryxz' + index" value="湖北" v-model="person.ryxz">
                <label :for="'personryxzradio2' + index">湖北</label>
                <input :id="'personryxzradio1' + index" type="radio" :name="'personryxz' + index" value="非湖北" v-model="person.ryxz">
                <label :for="'personryxzradio1' + index">非湖北</label>
              </div>
            </div>
            <div class="ryc1" v-show="person.ryxz == '非湖北'">
              <label style="max-width: 180px;">备注（如果来自其他重点疫区填是哪个地方）：</label>
              <div class="ryc2" @click="showSsxPicker(person)">
                <input type="text" class="ryc_txt" readonly placeholder="点击选择" v-model="person.qtzdyq">
              </div>
            </div>
            <div class="ryc1">
              <label :class="{require: !judgeRequire(person)}">长居/暂居：</label>
              <div class="ryc2">
                <input :id="'personcjzjradio2' + index" type="radio" :name="'personcjzj' + index" value="长居江阴" v-model="person.cjzj">
                <label :for="'personcjzjradio2' + index">长居江阴</label>
                <input :id="'personcjzjradio1' + index" type="radio" :name="'personcjzj' + index" value="暂居江阴" v-model="person.cjzj">
                <label :for="'personcjzjradio1' + index">暂居江阴</label>
              </div>
            </div>
            <div class="ryc1">
              <label>计划离澄时间：</label>
               <div class="ryc2">
                <input type="datetime-local" class="ryc_txt" v-model="person.lcsj">
              </div>
            </div>
            <div class="ryc1">
              <label :class="{require: !judgeRequire(person)}">居住乡镇：</label>
              <div class="ryc2 selectDiv">
                <select class="ryc2 search_select" v-model="person.jzxz">
                  <option value="">请选择</option>
                  <option value="澄江街道">澄江街道</option>
                  <option value="城东街道">城东街道</option>
                  <option value="南闸街道">南闸街道</option>
                  <option value="云亭街道">云亭街道</option>
                  <option value="夏港街道">夏港街道</option>
                  <option value="申港街道">申港街道</option>
                  <option value="利港街道">利港街道</option>
                  <option value="璜土镇">璜土镇</option>
                  <option value="青阳镇">青阳镇</option>
                  <option value="徐霞客镇">徐霞客镇</option>
                  <option value="月城镇">月城镇</option>
                  <option value="周庄镇">周庄镇</option>
                  <option value="华士镇">华士镇</option>
                  <option value="祝塘镇">祝塘镇</option>
                  <option value="新桥镇">新桥镇</option>
                  <option value="顾山镇">顾山镇</option>
                  <option value="长泾镇">长泾镇</option>
                </select>
              </div>
            </div>
            <div class="ryc1">
              <label>是否有密切接触史：</label>
              <div class="ryc2">
                <input :id="'personsfymqjcsradio2' + index" type="radio" :name="'personsfymqjcs' + index" value="是" v-model="person.sfymqjcs">
                <label :for="'personsfymqjcsradio2' + index">是</label>
                <input :id="'personsfymqjcsradio1' + index" type="radio" :name="'personsfymqjcs' + index" value="否" v-model="person.sfymqjcs">
                <label :for="'personsfymqjcsradio1' + index">否</label>
              </div>
            </div>
            <div class="ryc1">
              <label :class="{require: !judgeRequire(person)}">体温：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.tw">
              </div>
            </div>
            <div class="ryc1">
              <label :class="{require: !judgeRequire(person)}" style="min-width: 80px;">健康状况：</label>
              <div class="ryc2 ccheckbox">
                <div><input :id="'personsffrb1' + index" type="checkbox" :name="'personhczk' + index" value="无异常" v-model="person.sffr">
                <label :for="'personsffrb1' + index">无异常</label></div>
                <div><input :id="'personsffrb2' + index" type="checkbox" :name="'personhczk' + index" value="发热" v-model="person.sffr">
                <label :for="'personsffrb2' + index">发热</label></div>
                <div><input :id="'personsffrb3' + index" type="checkbox" :name="'personhczk' + index" value="咳嗽" v-model="person.sffr">
                <label :for="'personsffrb3' + index">咳嗽</label></div>
                <div><input :id="'personsffrb4' + index" type="checkbox" :name="'personhczk' + index" value="流涕" v-model="person.sffr">
                <label :for="'personsffrb4' + index">流涕</label></div>
                <div><input :id="'personsffrb5' + index" type="checkbox" :name="'personhczk' + index" value="胸痛" v-model="person.sffr">
                <label :for="'personsffrb5' + index">胸痛</label></div>
                <div><input :id="'personsffrb6' + index" type="checkbox" :name="'personhczk' + index" value="肌肉酸疼" v-model="person.sffr">
                <label :for="'personsffrb6' + index">肌肉酸疼</label></div>
                <div><input :id="'personsffrb7' + index" type="checkbox" :name="'personhczk' + index" value="关节疼" v-model="person.sffr">
                <label :for="'personsffrb7' + index">关节疼</label></div>
                <div><input :id="'personsffrb8' + index" type="checkbox" :name="'personhczk' + index" value="气促" v-model="person.sffr">
                <label :for="'personsffrb8' + index">气促</label></div>
                <div><input :id="'personsffrb9' + index" type="checkbox" :name="'personhczk' + index" value="腹泻" v-model="person.sffr">
                <label :for="'personsffrb9' + index">腹泻</label></div>
              </div>
              <!-- <div class="ryc2 selectDiv">
                <select class="search_select" v-model="person.sffr">
                  <option value="无">无</option>
                  <option value="发热">发热</option>
                  <option value="咳嗽">咳嗽</option>
                  <option value="胸闷">胸闷</option>
                </select>
              </div> -->
            </div>
            <div class="ryc1">
              <label :class="{require: !judgeRequire(person)}" style="min-width:80px;">当前状况：</label>
              <div class="ryc2 selectDiv">
                <select class="search_select" v-model="person.qxqk">
                  <option value="">请选择</option>
                  <option value="放行">放行</option>
                  <option value="劝返">劝返</option>
                  <option value="120转运">120转运</option>
                  <option value="集中观察">集中观察</option>
                  <option value="居家观察">居家观察</option>
                  <option value="医院留观">医院留观</option>
                  <option value="医院医疗">医院医疗</option>
                  <option value="解除观察">解除观察</option>
                  <option value="其他">其他</option>
                </select>
              </div>
            </div>
            <div class="ryc1" v-show="person.qxqk && person.qxqk != '放行' && person.qxqk != '劝返'">
              <label :class="{require: person.qxqk == '居家观察'}">观察开始时间：</label>
               <div class="ryc2">
                <input type="date" class="ryc_txt" v-model="person.gckssj">
              </div>
            </div>
            <div class="ryc1" v-show="person.qxqk && person.qxqk != '放行' && person.qxqk != '劝返'">
              <label :class="{require: person.qxqk == '居家观察'}">解除观察时间：</label>
               <div class="ryc2">
                <input type="date" class="ryc_txt" v-model="person.jcgcsj">
              </div>
            </div>
            <div class="ryc1">
              <label style="min-width:118px;" :class="{require: !judgeRequire(person)}">之前的14天内：</label>
              <div class="ryc2 ccheckbox">
                <div><input :id="'personsyqxb1' + index" type="checkbox" :name="'personsyqx' + index" value="居住/途径疫区省、或曾前往疫区" v-model="person.syqx">
                <label style="font-size:12px;" :for="'personsyqxb1' + index">居住/途径疫区省、或曾前往疫区</label></div>
                <div><input :id="'personsyqxb2' + index" type="checkbox" :name="'personsyqx' + index" value="近距离接触过来自疫区的人员" v-model="person.syqx">
                <label style="font-size:12px;" :for="'personsyqxb2' + index">近距离接触过来自疫区的人员</label></div>
                <div><input :id="'personsyqxb3' + index" type="checkbox" :name="'personsyqx' + index" value="近距离接触过肺炎疑似/确诊患者" v-model="person.syqx">
                <label style="font-size:12px;"  :for="'personsyqxb3' + index">近距离接触过肺炎疑似/确诊患者</label></div>
                <div><input :id="'personsyqxb4' + index" type="checkbox" :name="'personsyqx' + index" value="无上述情形" v-model="person.syqx">
                <label style="font-size:12px;" :for="'personsyqxb4' + index">无上述情形</label></div>
                <div><input :id="'personsyqxb5' + index" type="checkbox" :name="'personsyqx' + index" value="其他特殊情况" v-model="person.syqx">
                <label style="font-size:12px;" :for="'personsyqxb5' + index">其他特殊情况</label></div>
              </div>
            </div>
            <div class="ryc1">
              <label>疫区居住地址：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.whjzd">
              </div>
            </div>
            <div class="ryc1">
              <label>离开疫区日期：</label>
               <div class="ryc2">
                <input type="date" class="ryc_txt" v-model="person.lkwhrq">
              </div>
            </div>
            <div class="ryc1">
              <label>交通情况：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.cc">
              </div>
            </div>
            <div class="ryc1">
              <label>途经湖北是否有停留：</label>
              <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.sftl">
              </div>
            </div>
            <div class="ryc1">
              <label :class="{require: judgeRequire(person) != 1}">核查时间：</label>
               <div class="ryc2">
                <input type="datetime-local" class="ryc_txt" v-model="person.hcsj">
              </div>
            </div>
            <div class="ryc1">
              <label>同行人员一：</label>
               <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.txry1">
              </div>
            </div>
            <div class="ryc1">
              <label class="require orange">核查参与人[公安]：</label>
               <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.gacyr">
              </div>
            </div>
            <div class="ryc1">
              <label>核查参与人联系方式[公安]：</label>
               <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.galxfs">
              </div>
            </div>
            <div class="ryc1">
              <label class="require orange">核查参与人[政府]：</label>
               <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.wjwcyr">
              </div>
            </div>
            <div class="ryc1">
              <label>核查参与人联系方式[政府]：</label>
               <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.wjwlxfs">
              </div>
            </div>
            <div class="ryc1">
              <label>后续工作情况：</label>
               <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.hxgzqk">
              </div>
            </div>
            <div class="ryc1">
              <label>备注：</label>
               <div class="ryc2">
                <input type="text" class="ryc_txt" v-model="person.bz">
              </div>
            </div>
          </div>
        </template>
      </div>
      <div class="backText"><b>注：</b><br>1. 本表用于2020年1月5日以后离开武汉出差等停留过的人员。<br>2. 若为在武汉常住人员，请填写现住址，如为外来短暂停留人员，请填写酒店名称及地址。<br>3. 乘坐火车或飞机的，请同时填写车次/航班号、座位号。</div>
    </div>
  </div>
</template>

<script>
import VDistpicker from 'v-distpicker';
import { XButton, Popup, PopupPicker } from 'vux';
export default {
  name: "Add3",
  components: {
    XButton, Popup, PopupPicker, VDistpicker
  },
  data () {
    return {
      showSsxPick: false,
      ssxObject: {province: '', city: '', area: ''},
      item: {
        hcly: '110接处',
        lcfs: '公共交通',
        ggjtbz: '',
        jcclhp: '',
        jcclhplx: '蓝牌',
        jccllyd: '不明',
        pckd: this.$db.get('kakou') || '',
        dcsj: new Date().format('yyyy-MM-ddThh:mm'),
        persons: []
      },
      kklist: ['北卡（江阴北高速出口）',
        '南卡（江阴南高速出口）',
        '京沪高速璜塘出口',
        '沿江高速华士/华西出口',
        '长山卡（澄张公路）',
        '小湖卡（镇澄路）',
        '石庄卡',
        '利港汽渡口',
        '新桥澄扬路',
        '长安大道',
        '老文林卡口',
        '霞客卡（霞客大道）',
        '锡澄路',
        '海港大道',
        '顾山锡沙线',
        '江阴船闸卡口'
      ]
    };
  },
  methods: {
    judgeRequire (person) {
      if ((this.item.hcly == '指令核处' || this.item.hcly == '社区摸排') && (person.hczk == "不在江阴/已离澄（无法核查）" || person.hczk == "住址错误（无法核查）")) {
        return 1;
      }
      if ((this.item.hcly == '指令核处' || this.item.hcly == '社区摸排') && person.hczk == "无法联系（无法核查）") {
        return 2;
      }
      return 0;
    },
    showSsxPicker: function (person) {
      this.currentPerson = person;
      this.ssxObject = person.ssxObject;
      this.showSsxPick = true;
    },
    onChangeProvince1: function (a) {
      this.ssxObject.province = a.value;
      if (a.value == '台湾省') {
        this.showSsxPick = false;
      }
    },
    onChangeCity: function (a) {
      this.ssxObject.city = a.value;
    },
    onChangeArea: function (a) {
      if (a.value != '区') {
        this.ssxObject.area = a.value;
        this.showSsxPick = false;
        this.currentPerson.qtzdyq = this.ssxObject.province + '/' + this.ssxObject.city + '/' + this.ssxObject.area;
      }
    },
    yearOldJudge: (idCard) => {
      const year = idCard.substring(6, 10);
      const month = idCard.substring(10, 12);
      var yearOld = new Date().getFullYear() - year;
      if (parseInt(month) - 1 >= new Date().getMonth()) {
        yearOld--;
      }
      var gender = parseInt(idCard.substring(16, 17)) % 2;
      return {
        nl: yearOld,
        xb: gender ? '男' : '女'
      };
    },
    personSfzChanged: function (person, type) {
      var vm = this;
      if (type) {
        if (person.csrq) {
          var csrqstr = '000000' + new Date(person.csrq).format('yyyyMMdd') + '6770';
          var yearAndSex = vm.yearOldJudge(csrqstr);
          person.nl = yearAndSex.nl < 0 ? '0' : yearAndSex.nl;
        }
        return;
      }
      if (person.sfzhm && person.sfzhm.length == 18) {
        if (vm.$util.identityCodeValid(person.sfzhm)) {
          vm.$getAndLoad('列表', 'oa/ycdc/getInfo.jsp?sfzhm=' + person.sfzhm, function (data) {
            if (data.result) {
              person.lcsy = data.lcsy;
              person.lxfs = data.lxfs;
              person.nl = data.nl;
              person.sfymqjcs = data.sfymqjcs;
              person.xb = data.xb;
              person.xm = data.xm;
              person.zcjzdz = data.zcjzdz;
              person.zclxrlxfs = data.zclxrlxfs;
              person.zclxrxm = data.zclxrxm;
            } else {
              var yearAndSex = vm.yearOldJudge(person.sfzhm);
              person.xb = yearAndSex.xb;
              person.nl = yearAndSex.nl;
            }
          });
        } else {
          vm.$vux.toast.text('此身份证号码疑似不符合编码规则', 'bottom');
        }
      }
    },
    addNewPerson: function () {
      this.item.persons.push({
        useSfz: '1',
        sfzhm: '',
        csrq: '',
        xm: '',
        xb: '',
        nl: '',
        lxfs: '',
        lcsy: '务工',
        zcjzdz: '',
        zclxrxm: '',
        zclxrlxfs: '',
        gzdw: '',
        ryxz: '',
        qtzdyq: '',
        ssxObject: {province: '', city: '', area: ''},
        sfymqjcs: '否',
        // sfwg: '否',
        tw: '',
        sffr: [],
        zy: '',
        cjzj: '',
        jzxz: '',
        hczk: '',
        qxqk: '',
        syqx: [],
        gckssj: '',
        jcgcsj: '',
        whjzd: '',
        lkwhrq: '',
        sftl: '',
        cc: '',
        hcsj: new Date().format('yyyy-MM-ddThh:mm'),
        lcsj: '',
        // hcczbm: '指挥中心',
        gacyr: '',
        galxfs: '',
        wjwcyr: '',
        wjwlxfs: '',
        hxgzqk: '',
        bz: ''
      });
    },
    deletePerson: function (index) {
      this.item.persons.splice(index, 1);
    },
    reset: function () {
      this.item = {
        hcly: '110接处',
        lcfs: '公共交通',
        ggjtbz: '',
        jcclhp: '',
        jcclhplx: '蓝牌',
        jccllyd: '不明',
        pckd: this.$db.get('kakou') || '',
        dcsj: new Date().format('yyyy-MM-ddThh:mm'),
        persons: []
      };
    },
    save: function () {
      var vm = this;
      var params = {
        sjly: 'LX1',
        hcly: vm.item.hcly,
        lcfs: vm.item.lcfs,
        dcsj: vm.item.dcsj,
        persons: []
      };
      if (params.lcfs == '私家车辆') {
        Object.assign(params, {
          jcclhp: vm.item.jcclhp,
          jcclhplx: vm.item.jcclhplx,
          jccllyd: vm.item.jccllyd
        });
      } else {
        Object.assign(params, {
          ggjtbz: vm.item.ggjtbz
        });
      }
      if (params.hcly == '卡口检查') {
        Object.assign(params, {
          pckd: vm.item.pckd
        });
        if (!params.pckd) {
          vm.$vux.toast.text('请选择盘查卡点', 'bottom');
          return;
        }
      }
      vm.item.persons.forEach(function (person, index) {
        var obj = JSON.parse(JSON.stringify(person));
        if (obj.useSfz == '0') {
          obj.sfzhm = obj.csrq;
        }
        obj.sffr = obj.sffr.join(',');
        obj.syqx = obj.syqx.join(',');
        if (obj.qxqk != '放行' && obj.qxqk != '劝返') {
          obj.gckssj = '';
          obj.jcgcsj = '';
        }
        if (params.ryxz == '湖北') {
          obj.qtzdyq = '';
        }
        params.persons.push(obj);
      });
      for (let [ index, person ] of params.persons.entries()) {
        var validateArr = [];
        let judgeNumber = vm.judgeRequire(person);
        if (judgeNumber == 0) {
          validateArr = [
            {p: person.sfzhm, p1: '身份证号码/出生日期', p2: '填写'},
            {p: person.xm, p1: '姓名', p2: '填写'},
            {p: person.xb, p1: '性别', p2: '填写'},
            {p: person.nl, p1: '年龄', p2: '填写'},
            {p: person.hczk, p1: '核查状况', p2: '选择'},
            {p: person.zy, p1: '职业', p2: '选择'},
            {p: person.ryxz, p1: '人员性质', p2: '选择'},
            {p: person.cjzj, p1: '长居/暂居', p2: '选择'},
            {p: person.jzxz, p1: '居住乡镇', p2: '选择'},
            {p: person.tw, p1: '体温', p2: '填写'},
            {p: person.sffr, p1: '健康状况', p2: '选择'},
            {p: person.qxqk, p1: '当前状况', p2: '选择'},
            {p: person.syqx, p1: '之前的14天内', p2: '选择'},
            {p: person.hcsj, p1: '核查时间', p2: '选择'},
            {p: person.gacyr + person.wjwcyr, p1: '核查参与人', p2: '填写'}
          ];
        } else if (judgeNumber == 1) {
          validateArr = [
            {p: person.sfzhm, p1: '身份证号码/出生日期', p2: '填写'},
            {p: person.xm, p1: '姓名', p2: '填写'},
            {p: person.xb, p1: '性别', p2: '填写'},
            {p: person.nl, p1: '年龄', p2: '填写'},
            {p: person.hczk, p1: '核查状况', p2: '选择'},
            {p: person.lxfs, p1: '手机号', p2: '填写'},
            {p: person.ryxz, p1: '人员性质', p2: '选择'},
            {p: person.gacyr + person.wjwcyr, p1: '核查参与人', p2: '填写'}
          ];
        } else if (judgeNumber == 2) {
          validateArr = [
            {p: person.sfzhm, p1: '身份证号码/出生日期', p2: '填写'},
            {p: person.xm, p1: '姓名', p2: '填写'},
            {p: person.xb, p1: '性别', p2: '填写'},
            {p: person.nl, p1: '年龄', p2: '填写'},
            {p: person.hczk, p1: '核查状况', p2: '选择'},
            {p: person.hcsj, p1: '核查时间', p2: '选择'},
            {p: person.gacyr + person.wjwcyr, p1: '核查参与人', p2: '填写'}
          ];
        }
        if (person.qxqk == '居家观察') {
          validateArr.push({p: person.gckssj, p1: '观察开始时间', p2: '选择'});
          validateArr.push({p: person.jcgcsj, p1: '解除观察时间', p2: '选择'});
        }
        for (let n of validateArr) {
          var error = vm.$util.requireValidator(n.p, n.p1, n.p2);
          if (error) {
            vm.$vux.toast.text('人员' + (index + 1) + ':' + error, 'bottom');
            return;
          }
        }
      }
      // console.log(params);
      // if (1) {return;}
      vm.$vux.loading.show();
      vm.$paramPost('新增', 'oa/ycdc/investigate.jsp', params, function (data) {
        vm.$vux.loading.hide();
        if (data && data.success) {
          vm.$emit('refresh');
          vm.$vux.alert.show({
            title: '提示',
            content: '保存成功！',
            onHide () {
              vm.$router.push({path: '/'});
            }
          });
        } else {
          vm.$vux.toast.text(data.msg || '新增失败', 'bottom');
        }
      }, false);
    }

  },
  mounted: function () {
  }
};
</script>

<style lang="scss" scoped>
.visualBlock {
  background: #fff;
}
.infoitem {
  padding: 10px;
  .len {
    margin-bottom: 8px;
    .f1 {
      .inputvalue, select {
        width: 100%;
        height: 32px;
        font-size: 14px;
      }
      .value {
        line-height: 32px;
        background: white;
        margin-top: 3px;
        min-height: 32px;
      }
    }
  }
}
.img-uploads {
  /deep/ .cacheArea {
    flex-wrap: wrap;
    .item {
      margin-right: calc(33.3% - 100px);
      margin-bottom: 5px;
    }
  }
  .imgitem {
    img {
      max-width: 100%;
    }
  }
}
.title1 {
  background: #e6e6e6;
  height: 35px;
  line-height: 35px;
  font-weight: bold;
  padding-left: 10px;
  margin-bottom: 5px;
  color: #4c62c3;
}
.title2 {
  height: 30px;
  line-height: 30px;
  padding-left: 10px;
}
.backText {
  padding: 10px;
  font-size: 12px;
}
.ryc3 {
  border-top: #d8d8d8 1px solid;
}
label {
  max-width: 230px;
  &.require {
    &.orange {
      &::before {
      color: orange;
    }
    }
    &::before {
      content: '*';
      color: red;
    }
  }
}
.ccheckbox {
  height: unset !important;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  label {
    margin: 0 10px 0 5px;
  }
}
.scrollBody {
  position: fixed;
  top: 40px;
}
.img-uploads {
  padding: 5px;
  .key {
    line-height: 30px;
  }
  /deep/ .cacheArea {
    flex-wrap: wrap;
    margin-left: 15px;
    .item {
      margin-right: calc(33.3% - 100px);
      margin-bottom: 20px;
    }
  }
}
.ryca {
  border-bottom: #d8d8d8 1px solid;
  color: #808080;
  line-height: 25px;
  label {
    padding: 10px;
  }
}
.ryc4 {
  width: 120px;
  .ryc_btn {
    background: #ff8f31;
    height: 30px;
    margin: 10px;
  }
}
.ryc5 {
  display: flex;
  height: 50px;
  align-items: center;
  flex-direction: row-reverse;
  .ryc_btn {
    background: #ff0000;
    height: 30px;
    width: 120px;
    margin-right: 20px;
  }
}
.persons {
  .person {
    border-bottom: #d8d8d8 3px solid;
    .title {
      padding: 10px;
    }
  }
}
.expand {
  background: #c1daff;
  color: #fefdfd;
  text-align: center;
}
/*遮罩层*/
.blacks {
  position: fixed;
  width: 100%;
  height: 50%;
  z-index: 200;
  left: 0;
  top: 0;
  background: rgba(0, 0, 0, 0.45);
}
/*省市区三级联动*/
.divwrap {
  height: 50%;
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  z-index: 199;
}

/*外部*/
.divwrap > .distpicker-address-wrapper {
  color: #0d0d0d;
  height: 100%;
}

/*头部内容*/
.divwrap >>> .address-header ul li {
  flex-grow: 1;
  text-align: center;
}

/*内容部分*/
.divwrap >>> .address-container {
  overflow: scroll;
  height: 100%;
}

/*点过的地区内容*/
.divwrap >>> .address-container .active {
  color: red;
}
</style>
